import java.util.Scanner;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-07-27
 * Time: 16:19
 * To BE A Better Person-2020-3-2
 */
class A{
     volatile public int flag=1;
}
public class TestDemo_volatile {
    public static void main(String[] args) {
        A a=new A();
        Thread t1=new Thread(()->{
            while(a.flag!=0){

            }
        });
        Thread t2=new Thread(()->{
            Scanner sc=new Scanner(System.in);

                a.flag=sc.nextInt();


        });

        t1.start();
        t2.start();
    }

}

